//第一步：设置路由的相关配置--定义路由规则--
//导出路由-在mian.js全局引入--并且在app.vue设置路由显示的容器
// 路由-相关模块
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
//自定义路由规则
import Home from '../views/Home'
import Layout from '../views/Layout'
import Play from '../views/Play'
import Search from '../views/Search'
const routes = [
  {
    path: '/',
    redirect: '/layout',
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home', //直接显示一级路由和二级路由的home
    children: [
      {
        path: 'home',
        component: Home,
        meta: { title: '首页' },
      },
      {
        path: 'search',
        component: Search,
        meta: {
          title: '搜索',
        },
      },
    ],
  },
]
const router = new VueRouter({
  routes,
})
export default router
